package com.tfjybj.itoo.exam.provider.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tfjybj.itoo.exam.entity.EvaluationRecordEntity;
import com.tfjybj.itoo.exam.model.EvaluationRecordModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * TeEvaluationRecordDao接口
 * teEvaluationRecord表
 *
 * @author 杨江涛
 * @version 2.0.0
 * @since 2.0.0 2018-12-18 18:19:48
 */
@Repository("teEvaluationRecordDao")
public interface EvaluationRecordDao extends BaseMapper<EvaluationRecordEntity> {

    /**
     * 查询该题干的作答总人数
     * @param paperId  问卷id
     * @param schoolYearId  学期学年id
     * @param courseId 课程id
     * @param evaluationMainId 题干id
     * @return queryParticipationNumber
     * @author 杨晓慧
     * @since 2.0.0 2018-12-28 17:19:44
     */
   Integer queryParticipationNumber(@Param("paperId") String paperId, @Param("schoolYearId") String schoolYearId, @Param("courseId") String courseId, @Param("evaluationMainId") String evaluationMainId);

    /**
     * 查某一个问题下的学生作答各选项的比例
     * @param paperId  问卷id
     * @param schoolYearId  学期学年id
     * @param courseId 课程id
     * @param evaluationMainId 题干id
     * @return 各选项的比例
     * @author 杨江涛
     * @since 2.0.0 2019年3月20日19:22:22
     */
    List<EvaluationRecordModel> queryOptionRatioResult(@Param("paperId") String paperId, @Param("schoolYearId") String schoolYearId, @Param("courseId") String courseId, @Param("evaluationMainId") String evaluationMainId);
   /**
        * 实时更新问卷记录到数据库
        * @param
        * @return Boolean
        * @author 魏恩君
        * @since 2.0.0 2019/3/20
        */

    Boolean updateEvaluationRecord(@Param("model") EvaluationRecordModel model);

    Boolean updateEvaluationRecordById(@Param("model") EvaluationRecordModel model);

    /**
         * 查询学生已答题记录
         * @param paperId  问卷id
         * @param schoolYearId  学期学年id
         * @param courseId 课程id
         * @param studentId 学生ID
         * @return
         * @author 魏恩君
         * @since 2.0.0 2019/3/21
         */

    List<EvaluationRecordModel> queryStudentDoneRecord(@Param("paperId") String paperId, @Param("schoolYearId") String schoolYearId, @Param("courseId") String courseId, @Param("studentId") String studentId);

    /**
         * 查询学生问卷某题的答案
         * @param paperId  问卷id
         * @param schoolYearId  学期学年id
         * @param courseId 课程id
         * @param studentId 学生ID
         * @param evaluationMainId 题干id
         * @return string 答案
         * @author 魏恩君
         * @since 2.0.0 2019/3/22
         */

    String queryAnswerById(@Param("recordId") String recordId);

    /**
     * 查询学生问卷某题的答案
     * @param paperId  问卷id
     * @param schoolYearId  学期学年id
     * @param courseId 课程id
     * @param studentId 学生ID
     * @param evaluationMainId 题干id
     * @return string 答案
     * @author 魏恩君
     * @since 2.0.0 2019/3/22
     */

    String queryAnswer(@Param("courseId") String courseId, @Param("paperId") String paperId, @Param("evaluationMainId") String evaluationMainId, @Param("studentId") String studentId, @Param("schoolYearId") String schoolYearId);


    /**
     * 查某一个问题下的学生作答当前选项的总人数
     * @param paperId  问卷id
     * @param schoolYearId  学期学年id
     * @param courseId 课程id
     * @param evaluationMainId 题干id
     * @param evaluationSubId  选项id
     * @return 某一个问题下的学生作答当前选项的总人数
     * @author 杨江涛
     * @since 2.0.0 2019-3-22 16:26:56
     */
    String queryOptionSelectedNumberBySubId(@Param("paperId") String paperId, @Param("schoolYearId") String schoolYearId, @Param("courseId") String courseId, @Param("evaluationMainId") String evaluationMainId, @Param("evaluationSubId") String evaluationSubId);
}
